// 工单管理 相关接口

import service from '@/utils/request'
import constant from '@/utils/constant'
import Qs from 'qs'

const root = (process.env.NODE_ENV === 'development' ? '/api' : '')

// 获取列表========================================================================工单
export function workOrderlist(params) {
  return service({
    url: root + constant.order_list,
    method: 'get',
    params: params
  })
}

// 工单详情
export function orderDetails(params) {
  return service({
    url: root + constant.order_details,
    method: 'get',
    params: params
  })
}

// 更新工单状态
// export function workOrderStatus(params) {
//   return service({
//     url: root + constant.update_work_order_status,
//     method: 'post',
//     params: params
//   })
// }

// 更新工单状态
export function workOrderStatus(data) {
  return service({
    url: root + constant.update_work_order_status,
    method: 'post',
    data
  })
}

// 工单看板 ========================================================================
// 查询环比
export function queryChain(params) {
  return service({
    url: root + constant.query_chain,
    method: 'get',
    params: params
  })
}

// 查询工单数量按照status分组
export function queryOrderCount(params) {
  return service({
    url: root + constant.query_order_ount,
    method: 'get',
    params: params
  })
}

// 查询平均按时整改率
export function queryRectifyCount(params) {
  return service({
    url: root + constant.query_rectify_count,
    method: 'get',
    params: params
  })
}

// 查询每日事件数量分布
export function queryFlowCount(params) {
  return service({
    url: root + constant.query_flow_count,
    method: 'get',
    params: params
  })
}

// 查询优先级分布
export function queryPriority(params) {
  return service({
    url: root + constant.query_priority,
    method: 'get',
    params: params
  })
}

// 查询问题项排名
export function queryCheckItem(params) {
  return service({
    url: root + constant.query_check_item,
    method: 'get',
    params: params
  })
}
// 查询问题项门店详情
export function queryCheckItemDetail(params) {
  return service({
    url: root + constant.query_checkItem_detail,
    method: 'get',
    params: params
  })
}
// 查询问题整改逾期率-门店维度
export function queryOverdueCount(params) {
  return service({
    url: root + constant.query_overdue_count,
    method: 'get',
    params: params
  })
}

// 查询问题整改逾期率-人员维度
export function queryOverdueCountUser(params) {
  return service({
    url: root + constant.query_overdue_count_user,
    method: 'get',
    params: params
  })
}

//-------------------
// 查询所有考勤组包括考评项目 (工单类型)
export function listEvaluate(params) {
  return service({
    url: root + constant.list_evaluate,
    method: 'get',
    params: params
  })
}
// 上传工单的图片
export function uploadWkImg(data) {
  return service({
    url: root + constant.upload_wk_img,
    method: 'post',
    data: data
  })
}
// 添加工单
export function workorderAdd(data) {
  return service({
    url: root + constant.workorder_add,
    method: 'post',
    data: data
  })
}



// 获取列表=======================================================================
export function groupInfoList() {
	return service({
		url: root + constant.group_list,
		method: 'get',
	})
}